<!--
 * CoreUI - Open Source Bootstrap Admin Template
 * @version v1.0.0-alpha.2
 * @link http://coreui.io
 * Copyright (c) 2016 creativeLabs Łukasz Holeczek
 * @license MIT
 -->
<!DOCTYPE html>
<html lang="ug" dir="rtl">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="CoreUI Bootstrap 4 Admin Template">
    <meta name="keyword" content="CoreUI Bootstrap 4 Admin Template">
    <!-- <link rel="shortcut icon" href="assets/ico/favicon.png"> -->
    <title>تۇلپار</title>
    <!-- Icons -->
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link href="css/simple-line-icons.css" rel="stylesheet">
    <!-- Main styles for this application -->
    <link href="dest/style.css" rel="stylesheet">
    <!-- datepicker style -->
    <link href="css/date/datepicker.css" rel="stylesheet">

    <!-- AngularJS 1.5.5 -->
    <script src="js/angular/angular.min.js"></script>
</head>
<!-- BODY options, add following classes to body to change options
		1. 'compact-nav'     	  - Switch sidebar to minified version (width 50px)
		2. 'sidebar-nav'		  - Navigation on the left
			2.1. 'sidebar-off-canvas'	- Off-Canvas
				2.1.1 'sidebar-off-canvas-push'	- Off-Canvas which move content
				2.1.2 'sidebar-off-canvas-with-shadow'	- Add shadow to body elements
		3. 'fixed-nav'			  - Fixed navigation
		4. 'navbar-fixed'		  - Fixed navbar
	-->

<body class="navbar-fixed sidebar-nav fixed-nav">
    <header class="navbar">
        <div class="container-fluid">
            <button class="navbar-toggler mobile-toggler hidden-lg-up" type="button">&#9776;</button>
            <a class="navbar-brand" href="#"></a>
            <ul class="nav navbar-nav hidden-md-down">
                <li class="nav-item">
                    <a class="nav-link navbar-toggler layout-toggler" href="#">&#9776;</a>
                </li>
            </ul>
            <ul class="nav navbar-nav pull-left hidden-md-down">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                        <img src="" class="img-avatar" onerror="this.src='img/avatars/default.jpg'">
                        <span id="text-my-name" class="hidden-md-down"></span>
                    </a>
                    <div class="dropdown-menu dropdown-menu-right">
                        <div class="dropdown-header text-xs-center">
                            <strong>مىنىڭ</strong>
                        </div>
                        <a class="dropdown-item" href="#" onclick="loadContent('avatar.html')"><i class="fa fa-user"></i> باش سۈرىتىم </a>
                        <a class="dropdown-item" href="#" onclick="loadContent('my_info.html')"><i class="fa fa-wrench"></i> ئۇچۇرۇم </a>
                        <div class="divider"></div>
                        <a class="dropdown-item" href="#" onclick="loadContent('change_pwd.html')"><i class="fa fa-lock"></i> شېفىر ئۆزگەرتىمەن </a>
                    </div>
                </li>

            </ul>
        </div>
    </header>
    <div class="sidebar">
        <nav class="sidebar-nav">
            <ul class="nav">
                <li class="nav-item">
                    <a class="nav-link" href="index.html"><i class="icon-home"></i> باش بەت <span class="tag tag-info"> يىڭى </span></a>
                </li>

                <li class="nav-title">
                    باشقۇرغۇچى
                </li>
                 <li class="nav-item">
                    <a id="manager-list" class="nav-link" href="#" onclick="loadContent('manager_list.html')"><i class="icon-list"></i> تىزىملىك & تەھرىرلەش </a>
                    <a class="nav-link" href="#" onclick="loadContent('add_manager.html')"><i class="icon-user-follow"></i> باشقۇرغۇچى قوشۇش </a>
                </li>

                <li class="nav-title">
                    مەھسۇلات
                </li>
                <li class="nav-item">
                    <a id="vav-add-battery" class="nav-link" href="#" onclick="loadContent('add_battery.html')"><i class="icon-plus"></i> مەھسۇلات قوشۇش </a>
                    <a class="nav-link" href="#" onclick="loadContent('battery_statistics.html')"><i class="icon-chart"></i> مەھسۇلات ستاستىكا </a>
                </li>

                <li class="nav-title">
                   باشقىلار
                </li>
                 <li class="nav-item">
                    <a class="nav-link" id="contact" onclick="loadContent('contact.html')" href="#"><i class="icon-phone"></i> ئالاقىلىشىڭ </a>
                    <a class="nav-link" href="#"><i class="icon-earphones-alt"></i> مەسلەھەت سوراش </a>
                    <a class="nav-link" onclick="loadContent('avatar.html')" href="#"><i class="icon-docs"></i> ھەمكارلىشىڭ </a>
                </li>

            </ul>
        </nav>
    </div>
    <!-- Main content -->
    <main class="main" id="main-content">
        <!--/.container-->

    </main>


    <footer class="footer">
        <span class="text-left">
            <a href="http://coreui.io">CoreUI</a> &copy; 2016 creativeLabs.
        </span>
        <span class="pull-right">
            Powered by <a href="http://coreui.io">CoreUI</a>
        </span>
    </footer>
    <!-- Bootstrap and necessary plugins -->
    <script src="js/libs/jquery.min.js"></script>
    <script src="js/libs/tether.min.js"></script>
    <script src="js/libs/bootstrap.min.js"></script>
    <script src="js/libs/pace.min.js"></script>

    <!-- Plugins and scripts required by all views -->
    <script src="js/libs/Chart.min.js"></script>

    <!-- CoreUI main scripts -->

    <script src="js/app.js"></script>

    <!-- Plugins and scripts required by this views -->
    <!-- Custom scripts required by this view -->
    <script src="js/views/main.js"></script>

    <!-- alert dialog (依赖jquery) -->
    <script src="js/dialogs.js"></script>

    <!-- url & request (依赖dialogs.js) -->
    <script src="js/net.js"></script>

    <!-- datepicker -->
    <script src="js/date/datepicker.js"></script>
    <script src="js/date/datepicker.zh-CN.js"></script>
    <script src="js/date/datepicker.ug-CN.js"></script>

    <!-- script for index.html -->
    <script type="text/javascript">

        $(document).ready(function () {

            //登录用户，暂时写死
            window.localStorage.setItem('login_id',"2");
            //加载登录用户信息
            loadHeaderInfo();

        });

        function loadHeaderInfo() {

            var myMgrId = localStorage.getItem('login_id');
            net.get('manager/one',{'mId':myMgrId},null,function (response) {
                var name  = response.data.mName;
                var avatarLoc = response.data.mPic;

                $("#text-my-name").html(name);
                if(avatarLoc == null || avatarLoc == undefined || avatarLoc == ''){ avatarLoc ="/img/avatars/default.jpg";}
                $(".img-avatar").attr('src',"/tulpar"+avatarLoc);
                //
                window.localStorage.setItem('avatarLoc',"/tulpar"+avatarLoc);

            });
        }

        //sidebar点击事件
        function loadContent(src) {
            var url = "html/"+src;
            $.get(url,function (data,status) {
                if(status === "success"){
                    $("#main-content").html(data);
                }else{
                    var err = {'code':1,'msg':status};
                    dia.alert('ئەپسۇس','مەسىلە كۆرۈلدى!',['ئالاقىلىشىمەن','ۋاز كىچىمەن'],'fa fa-times',function (btn_name) {
                        if(btn_name == 'ئالاقىلىشىمەن'){ $(".sidebar .nav-item #contact").click(); }
                        if(btn_name == 'ۋاز كىچىمەن'){ /* do nothing */ }
                    },err);
                }
            })
        }

    </script>

</body>

</html>
